package com.xiaoxin.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xiaoxin.dubbo.mappers.QuestionMapper;
import com.xiaoxin.model.domain.Question;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author xiaoxiaode
 * @date 2021-08-30-18:35
 **/
@DubboService
public class QuestionServiceImpl implements QuestionApi {
    @Autowired
    private QuestionMapper questionMapper;


    @Override
    public Question findByUserId(Long id) {
        QueryWrapper<Question> qw = new QueryWrapper<>();
        qw.eq("user_id", id);
        return questionMapper.selectOne(qw);
    }

    @Override
    public void save(Question question1) {
        questionMapper.insert(question1);
    }

    @Override
    public void update(Question question) {
        questionMapper.updateById(question);
    }
}
